/* Mark Liu
/* Claw.java
/* All the methods for running the claw
 * Motor for up and down 
 * Pneumatics for the fingers 
/*----------------------------------------------------------------------------*/
package logomotion_2011;

import edu.wpi.first.wpilibj.Solenoid;
import edu.wpi.first.wpilibj.Victor;

public class Claw {

    //Solenoid for tube arm flipper
    public static Solenoid solenoid_flipper_foward = new Solenoid(8, 5);
    public static Solenoid solenoid_flipper_back = new Solenoid(8, 6);
    //Claw Victoe
    public static Victor arm_pickup = new Victor(8);

    /***************************************************************************
     * Method that runs motor to lower and raise the arm
     * Speeds at constant
     * + is Up and - is Down
     **************************************************1************************/
    public static void Telop_Arm_Winch() {
        //Arm up
        if(!(DriverStation_IO.getDigital(Constants.psoc_arm_up))||Joysticks.joystick1.getRawButton(Constants.joystick_arm_up)) {
            arm_pickup.set(1); 
        }
        //Arm down
        else if(!(DriverStation_IO.getDigital(Constants.psoc_arm_down)) || Joysticks.joystick1.getRawButton(Constants.joystick_arm_down)) {
            arm_pickup.set(-.25);
        }
        //STOP
        else{
            arm_pickup.set(0);
        }
    }
    
    /***************************************************************************
     * Method that runs the flipper arm on the tower
     * Base on the PSoC 
     * Uses one 2 way switch 
    ****************************************************************************/
    public static void Telop_Arm_Fingers() {
        //Close
        if (!DriverStation_IO.getDigital(Constants.psoc_claw)) 
                Claw_Close();
        //Copen
        if (DriverStation_IO.getDigital(Constants.psoc_claw)) 
                Claw_Open();
    }

    public static void Claw_Open() {
        solenoid_flipper_foward.set(true);
        solenoid_flipper_back.set(false);
    }

    public static void Claw_Close() {
        solenoid_flipper_foward.set(false);
        solenoid_flipper_back.set(true);
    }
}
